<?php

class Application_Form_AddUser extends Zend_Form {

    public function init(){
            // Set the method for the display form to POST
        $this->setMethod('post');
 
        //Last Name element
        $this->addElement('text', 'last_name', array(
            'label'      => 'Nume:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
            	array('StringLength', false, array(0, 50)),
            )
        ));
        
        //First Name element
        $this->addElement('text', 'first_name', array(
        		'label'      => 'Prenume:',
        		'required'   => true,
        		'filters'    => array('StringTrim'),
        		'validators' => array(
        				array('StringLength', false, array(0, 50)),
        		)
        ));
        
        $this->addElement('text', 'email', array(
            'label'      => 'E-mail:',
            'required'   => true,
            'filters'    => array('StringTrim', 'StringToLower'),
            'validators' => array(
                'EmailAddress',
            	array('StringLength', false, array(0, 50)),
            )
        ));
        
        $this->addElement('password', 'password', array(
        		'label'      => 'Parola:',
        		'required'   => true,
        		'filters'    => array('StringTrim'),
        		'validators' => array(
        				array('StringLength', false, array(0, 50)),
        		)
        ));
        
        $this->addElement('text', 'address', array(
        		'label'      => 'Adresa:',
        		'required'   => true,
        		'filters'    => array('StringTrim'),
        		'validators' => array(
        				array('StringLength', false, array(0, 150)),
        		)
        ));
        
        // is_admin element
        $this->addElement('checkbox', 'is_admin', array(
            'label' => 'Admin:',
        ));
  
        // Add the submit button
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Adauga Utilizator',
        ));
    }
}

